package com.lagou.rmi.server;

import com.lagou.rmi.service.impl.UserServiceImpl;

import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

/**
 * @description:
 * @author: yx
 * @date: 2021/11/23 16:31
 */
public class RmiServer {

    public static void main(String[] args) {
        try {
            //1.注册Registry
            Registry registry = LocateRegistry.createRegistry(9998);
            //2.创建远程对象,并注册到服务端注册表上
            registry.rebind("userService", new UserServiceImpl());
            System.out.println("---rmi服务端启动完成---");
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

}
